using UnityEngine;

public class DO
{
	private static CampaignModel _campaignData;

	private static PlaygroundModel _playgroundData;

	private static PlayerModel _playerData;

	public static CampaignModel Campaign
	{
		get
		{
			if (_campaignData == null)
			{
				_campaignData = JsonUtility.FromJson<CampaignModel>(SaveLoad.LoadString("Campaign"));
				if (_campaignData == null)
				{
					_campaignData = new CampaignModel();
				}
			}
			return _campaignData;
		}
	}

	public static PlaygroundModel Playground
	{
		get
		{
			if (_playgroundData == null)
			{
				_playgroundData = JsonUtility.FromJson<PlaygroundModel>(SaveLoad.LoadString("Playground"));
				if (_playgroundData == null)
				{
					_playgroundData = new PlaygroundModel();
				}
			}
			return _playgroundData;
		}
	}

	public static PlayerModel Player
	{
		get
		{
			if (_playerData == null)
			{
				_playerData = JsonUtility.FromJson<PlayerModel>(SaveLoad.LoadString("Player"));
				if (_playerData == null)
				{
					_playerData = new PlayerModel();
				}
			}
			return _playerData;
		}
	}

	public static void NewCampaign()
	{
		SaveLoad.DeleteString("Campaign");
		_campaignData = new CampaignModel();
	}

	public static void ReLoadCampaign()
	{
		_campaignData = null;
	}
}
